package form;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

import trangchu.UtilDelegate;

public class DSJ_HangHoa {
	public String SttSp;
	public String NhomSP;
	public String TenSP;
	public String DonViSP;
	public int SoLuong;
	public int GiaVon;
	public int GiaBan;
	
	public String getSttSp() {
		return SttSp;
	}
	public void setSttSp(String maSP) {
		SttSp = maSP;
	}
	public String getNhomSP() {
		return NhomSP;
	}
	public void setNhomSP(String nhomSP) {
		NhomSP = nhomSP;
	}
	public String getTenSP() {
		return TenSP;
	}
	public void setTenSP(String tenSP) {
		TenSP = tenSP;
	}
	public String getDonViSP() {
		return DonViSP;
	}
	public void setDonViSP(String donViSP) {
		DonViSP = donViSP;
	}
	public int getSoLuong() {
		return SoLuong;
	}
	public void setSoLuong(int soLuong) {
		SoLuong = soLuong;
	}
	public int getGiaVon() {
		return GiaVon;
	}
	public void setGiaVon(int giaVon) {
		GiaVon = giaVon;
	}
	public int getGiaBan() {
		return GiaBan;
	}
	public void setGiaBan(int giaBan) {
		GiaBan = giaBan;
	}
	

	public Vector<DSJ_HangHoa> getUsers(){
		Vector list = new Vector();;
		Connection con =UtilDelegate.getConnection();		
		PreparedStatement st;
		try {
			st = con.prepareStatement("select * from HangHoa  join NhomHang on HangHoa.NhomSP = NhomHang.MaNH join DonVi on HangHoa.DonViSP = DonVi.MaDV");
			ResultSet rs = st.executeQuery();
			while(rs.next()){
				
				Vector<String> b = new Vector<String>();
				b.add(rs.getString("SttSp"));
				b.add(rs.getString("TenNH"));
				b.add(rs.getString("TenSP"));
				b.add(rs.getString("TenDV"));
				b.add(rs.getString("SoLuong"));
				b.add(rs.getString("GiaVon"));
				b.add(rs.getString("GiaBan"));
				list.add(b);
								
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return list;
	}

}
